package cn.imnu.legalaid.entity;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import java.time.LocalDateTime;
import lombok.Data;
import lombok.Getter;

/**
 * 用户表
 * @TableName users
 */
@TableName(value ="users")
@Data
public class User {
    /**
     * 用户角色枚举
     */
    @Getter
    public enum UserRole {
        CLIENT("client"),
        LAWYER("lawyer"),
        ADMIN("admin");

        private final String value;

        UserRole(String value) {
            this.value = value;
        }

    }

    /**
     * 用户状态枚举
     */
    @Getter
    public enum UserStatus {
        ACTIVE("active"),
        INACTIVE("inactive"),
        SUSPENDED("suspended");

        private final String value;

        UserStatus(String value) {
            this.value = value;
        }

    }


    /**
     * 用户id
     */
    @TableId(value = "id", type = IdType.AUTO)
    private Integer id;

    /**
     * 用户名
     */
    @TableField(value = "username")
    private String username;

    /**
     * 用户邮箱
     */
    @TableField(value = "email")
    private String email;

    /**
     * 用户密码
     */
    @TableField(value = "password_hash")
    private String passwordHash;

    /**
     * 用户手机号
     */
    @TableField(value = "phone")
    private String phone;

    /**
     * 用户头像
     */
    @TableField(value = "avatar_url")
    private String avatarUrl;

    /**
     * 用户角色
     */
    @TableField(value = "role")
    private UserRole role;

    /**
     * 用户真实姓名
     */
    @TableField(value = "real_name")
    private String realName;

    /**
     * 用户身份证号
     */
    @TableField(value = "id_card")
    private String idCard;

    /**
     * 创建时间
     */
    @TableField(value = "created_at")
    private LocalDateTime createdAt;

    /**
     * 修改时间
     */
    @TableField(value = "updated_at")
    private LocalDateTime updatedAt;

    /**
     * 上次登录时间
     */
    @TableField(value = "last_login")
    private LocalDateTime lastLogin;

    /**
     * 用户账号状态
     */
    @TableField(value = "status")
    private UserStatus status;
}